//
//  LZRegisterBottomView.m
//  DoctorFAQs
//
//  Created by langZai on 2017/2/16.
//  Copyright © 2017年 zjq. All rights reserved.
//

#import "LZRegisterBottomView.h"

@interface LZRegisterBottomView ()

@end

@implementation LZRegisterBottomView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        UILabel *numLabel = [[UILabel alloc] init];
        numLabel.text = @"+86";
        numLabel.font = FONT(16);
        numLabel.textColor = KHColorFromRGB(0x333333);
        numLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:numLabel];
        [numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20 *xsIZE);
            make.top.equalTo(self).offset(20 *ysIZE);
        }];
        
        // 手机号textField
        _lzphoneTextField = [[UITextField alloc] init];
        //_phoneTextField.delegate = self;
        _lzphoneTextField.font = NEWFONT(16);
        _lzphoneTextField.placeholder = @"您的手机号码";
        _lzphoneTextField.textColor = KHColorFromRGB(0x333333);
        _lzphoneTextField.textAlignment = NSTextAlignmentLeft;
        _lzphoneTextField.keyboardType = UIKeyboardTypeNumberPad;
        //_phoneTextView.backgroundColor = [UIColor redColor];
        [self addSubview:_lzphoneTextField];
        [_lzphoneTextField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.sizeOffset(CGSizeMake((SCREEN_Width - 200) * xsIZE, 30 *ysIZE));
            make.left.equalTo(self.mas_left).offset(100*xsIZE);
            make.centerY.equalTo(numLabel);
            
        }];
        
        // 占位文字
        //    _phonePlaceLabel = [[UILabel alloc] init];
        //    _phonePlaceLabel.text = @"您的手机号码";
        //    _phonePlaceLabel.textColor = KHColorFromRGB(0xaaaaaa);
        //    _phonePlaceLabel.font = NEWFONT(16);
        //    [_phoneTextField addSubview:_phonePlaceLabel];
        //    [_phonePlaceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        //        make.centerX.equalTo(self.view);
        //        make.centerY.equalTo(_phoneTextField);
        //    }];
        
        // 横线
        UIView *lineView = [[UIView alloc] init];
        lineView.backgroundColor = KHColorFromRGB(0x4bb92c);
        [self addSubview:lineView];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            //        make.size.sizeOffset(CGSizeMake((SCREEN_Width - 40) *xsIZE, 1 *ysIZE));
            //        make.centerX.equalTo(self.view);
            //        make.top.equalTo(_phoneTextField.mas_bottom).offset(20 *ysIZE);
            make.left.equalTo(self).offset(20*xsIZE);
            make.right.equalTo(self).offset(-20*xsIZE);
            make.top.equalTo(self).offset(55 *ysIZE);
            make.height.offset(ysIZE);
        }];
        
        // 验证码
        UILabel *safeCodeLabel = [[UILabel alloc] init];
        safeCodeLabel.text = @"验证码";
        safeCodeLabel.font = FONT(16);
        safeCodeLabel.textColor = KHColorFromRGB(0x333333);
        safeCodeLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:safeCodeLabel];
        [safeCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20 * xsIZE);
            make.top.equalTo(lineView.mas_bottom).offset(20 *ysIZE);
        }];
        
        // 验证码textField
        _safeCodeTextField = [[UITextField alloc] init];
        _safeCodeTextField.keyboardType = UIKeyboardTypeNumberPad;
        _safeCodeTextField.font = NEWFONT(16);
        _safeCodeTextField.placeholder = @"验证码";
        _safeCodeTextField.textColor = KHColorFromRGB(0x333333);
        _safeCodeTextField.textAlignment = NSTextAlignmentLeft;
        [self addSubview:_safeCodeTextField];
        [_safeCodeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.sizeOffset(CGSizeMake((SCREEN_Width - 250) *xsIZE, 30 *ysIZE));
            make.left.equalTo(self.mas_left).offset(100*xsIZE);
            make.centerY.equalTo(safeCodeLabel);
        }];
        
        // 下面的横线
        UIView *lineViewB = [[UIView alloc] init];
        lineViewB.backgroundColor = KHColorFromRGB(0x4bb92c);
        [self addSubview:lineViewB];
        [lineViewB mas_makeConstraints:^(MASConstraintMaker *make) {
            //        make.size.sizeOffset(CGSizeMake((SCREEN_Width - 40) *xsIZE, 1 *ysIZE));
            //        make.centerX.equalTo(self.view);
            //        make.top.equalTo(_pwdTextField.mas_bottom).offset(20 *ysIZE);
            make.left.equalTo(self).offset(20*xsIZE);
            make.right.equalTo(self).offset(-20*xsIZE);
            make.height.offset(ysIZE);
            make.top.equalTo(lineView.mas_bottom).offset(55 *ysIZE);
            
        }];
        
        
        // 获取button
        _getBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_getBtn setTitle:@"获取" forState:UIControlStateNormal];
        [_getBtn.layer setMasksToBounds:YES];
        [_getBtn.layer setCornerRadius:12.0];
        [_getBtn.layer setBorderWidth:1.0];
        _getBtn.layer.borderColor = KHGreenColor.CGColor;
        
        [_getBtn setTitleColor:KHGreenColor forState:UIControlStateNormal];
        [_getBtn setBackgroundColor:KHColorFromRGB(0xffffff)];
        [self addSubview:_getBtn];
        [_getBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.sizeOffset(CGSizeMake(60*xsIZE, 25*ysIZE));
            make.right.equalTo(self.mas_right).offset(-20 *xsIZE);
            make.centerY.equalTo(_safeCodeTextField);
        }];
        
        //密码Label
        UILabel *pwdLabel = [UILabel new];
        pwdLabel.text = @"密码";
        pwdLabel.font = FONT(16);
        pwdLabel.textColor = KHColorFromRGB(0x333333);
        pwdLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:pwdLabel];
        [pwdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20 * xsIZE);
            make.top.equalTo(lineViewB.mas_bottom).offset(20 *ysIZE);
        }];
        
        // 密码textField
        _lz_pwdTextField = [[UITextField alloc] init];
        _lz_pwdTextField.keyboardType = UIKeyboardTypeURL;
        _lz_pwdTextField.font = NEWFONT(16);
        _lz_pwdTextField.placeholder = @"填写密码";
        _lz_pwdTextField.secureTextEntry = YES;
        _lz_pwdTextField.textColor = KHColorFromRGB(0x333333);
        _lz_pwdTextField.textAlignment = NSTextAlignmentLeft;
        [self addSubview:_lz_pwdTextField];
        [_lz_pwdTextField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.sizeOffset(CGSizeMake((SCREEN_Width - 200) *xsIZE, 30 *ysIZE));
            make.left.equalTo(self.mas_left).offset(100*xsIZE);
            make.centerY.equalTo(pwdLabel);
        }];
        
        // 密码下面的横线
        UIView *lineViewC = [[UIView alloc] init];
        lineViewC.backgroundColor = KHColorFromRGB(0x4bb92c);
        [self addSubview:lineViewC];
        [lineViewC mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20*xsIZE);
            make.right.equalTo(self).offset(-20*xsIZE);
            make.height.offset(ysIZE);
            make.top.equalTo(lineViewB.mas_bottom).offset(55 *ysIZE);
            
        }];
        
        //确认密码
        UILabel *conPwdLabel = [UILabel new];
        conPwdLabel.text = @"确认密码";
        conPwdLabel.font = FONT(16);
        conPwdLabel.textColor = KHColorFromRGB(0x333333);
        conPwdLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:conPwdLabel];
        [conPwdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20 * xsIZE);
            make.top.equalTo(lineViewC.mas_bottom).offset(20 *ysIZE);
        }];
        
        //再次填写密码TextField
        _conPwdTextField = [[UITextField alloc] init];
        _conPwdTextField.keyboardType = UIKeyboardTypeURL;
        _conPwdTextField.font = NEWFONT(16);
        _conPwdTextField.placeholder = @"再次填写密码";
        _conPwdTextField.secureTextEntry = YES;
        _conPwdTextField.textColor = KHColorFromRGB(0x333333);
        _conPwdTextField.textAlignment = NSTextAlignmentLeft;
        [self addSubview:_conPwdTextField];
        [_conPwdTextField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.sizeOffset(CGSizeMake((SCREEN_Width - 200) *xsIZE, 30 *ysIZE));
            make.left.equalTo(self.mas_left).offset(100*xsIZE);
            make.centerY.equalTo(conPwdLabel);
        }];
        
        // 再次填写密码下面的横线
        UIView *lineViewD = [[UIView alloc] init];
        lineViewD.backgroundColor = KHColorFromRGB(0x4bb92c);
        [self addSubview:lineViewD];
        [lineViewD mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20*xsIZE);
            make.right.equalTo(self).offset(-20*xsIZE);
            make.height.offset(ysIZE);
            make.top.equalTo(lineViewC.mas_bottom).offset(55 *ysIZE);
        }];
        
        // 注册按钮
        _registerButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_registerButton setTitle:@"注册" forState:UIControlStateNormal];
        [_registerButton setBackgroundColor:KHColorFromRGB(0x7bd661)];
        _registerButton.titleLabel.font = NEWFONT(18);
        _registerButton.layer.cornerRadius = 5;
        [_registerButton setTitleColor:KHColorFromRGB(0xffffff) forState:UIControlStateNormal];
        [self addSubview:_registerButton];
        [_registerButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20*xsIZE);
            make.right.equalTo(self).offset(-20*ysIZE);
            make.top.equalTo(lineViewD.mas_bottom).offset(25 *ysIZE);
            make.height.offset(45*ysIZE);
        }];
        
        //点击注册Label
        UILabel *clickLabel = [[UILabel alloc] init];
        clickLabel.text = @"点击注册，表示同意";
        clickLabel.font = FONT(12);
        clickLabel.textColor = KHColorFromRGB(0x666666);
        clickLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:clickLabel];
        [clickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(40 *xsIZE);
            make.top.equalTo(_registerButton.mas_bottom).offset(15 *ysIZE);
        }];
        
        //用户协议button
        _dealBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_dealBtn setTitle:@"《用户协议》" forState:UIControlStateNormal];
        _dealBtn.titleLabel.font = NEWFONT(17);
        [_dealBtn setTitleColor:KHColorFromRGB(0x4bb92c) forState:UIControlStateNormal];
        [self addSubview:_dealBtn];
        [_dealBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(clickLabel.mas_right);
            make.centerY.equalTo(clickLabel);
        }];
        
        
    }
    return self;
}

@end
